<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">
    <title>粉粉管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">
    <!--Animation css-->
    <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">
    <!--Icon-fonts css-->
    <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">
    <!-- Plugins css -->
    <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">
    <!-- DataTables -->
    <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />
    <!-- Custom styles for this template -->
    <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">
    <!-- My styles for this template -->
    <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet"></head>

<body>

    <!-- Aside Start-->
    <!--{template admin_v2/leftside}-->
    <!-- Aside Ends-->

    <!--Main Content Start -->
    <section class="content">

        <!-- Header -->
        <!--{template admin_v2/header}-->
        <!-- Header Ends -->

        <!-- Page Content Start -->
        <!-- ================== -->

        <div class="wraper container-fluid user-list">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">皮肤包商店</h3>
                        </div>
                       
                        
                        <div class="panel-body">         
                        	<div class="row">
                            		<div class="col-md-6 col-sm-6 col-xs-6">
		                                <button class="btn btn-primary" data-toggle="modal" data-target="#add{$goods}">添加</button>                  
									       <div id="add{$goods}" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="custom-width-modalLabel" aria-hidden="true" style="display: none;">
				                             <div class="modal-dialog" style="width:443px">
				                                 <div class="modal-content">
				                                 <form action="admin.php" method="get" id="addsourcedata">
				                                     <div class="modal-header">
				                                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				                                         <h4 class="modal-title" id="custom-width-modalLabel">添加包文件</h4>
				                                     </div>
				                                     <div class="modal-body">
				                                      	<div class="row"> 
				                                              <div class="col-md-4">
				                                                  <div class="form-group"> 
				                                                      <label for="labelid" class="control-label">id号</label>                            
				                                                  	  <input class="form-control" id="labelid" type="text"  placeholder="id" name="id">
				                                                  </div> 
				                                              </div> 
				                                              <div class="col-md-4">
				                                                  <div class="form-group"> 
				                                                      <label for="labelpid" class="control-label">素材pid</label>
				                                                      <input class="form-control" id="labelpid" type="text" placeholder="pid" name="pid">
				                                                  </div> 
				                                              </div>
															<div class="col-md-4">
																<div class="form-group">
																	<label for="labeltype" class="control-label">包类型</label>
																	<select name="type" class="form-control" id="labeltype">
																		<option value="5">皮肤包</option>
																		<option value="16">书桌包</option>
																	</select>
																</div>
															</div>
				                                          </div>
				                                           <div class="row"> 
				                                              <div class="col-md-6"> 
				                                                  <div class="form-group"> 
				                                                      <label for="labeltag" class="control-label">状态</label> 	
				                                                  	  <select name="status" class="form-control" id="labeltag">
				                                                  	  		<option value="1">下架</option>
				                                                  	   		<option value="0">上架</option>
																	  </select>
				                                    	          </div> 
				                                              </div> 
				                                              <div class="col-md-6"> 
				                                                  <div class="form-group"> 
				                                                      <label for="labelstatus" class="control-label">平台</label>                                                                         	 
				                                                  	  <select  name="platform" class="form-control" id="labelstatus">
																		<option value="pinkdiaryandroid" >安卓</option>
																		<option value="pinkdiaryios" >IOS</option>
																		<option value="pinkdiaryproios" >IOS专业版</option>
																	  </select>
				                                                  </div> 
				                                              </div> 
				                                          </div> 
				                                        
				                                          <div class="row"> 
				                                              <div class="col-md-6"> 
				                                                  <div class="form-group"> 
				                                                      <label for="labelexpire_time" class="control-label">min</label> 	
				                                                  	  <input class="form-control" id="labelexpire_time" value="0" type="text"  placeholder="支持的最小版本号" name="min_version">
				                                    	          </div> 
				                                              </div> 
				                                              <div class="col-md-6"> 
				                                                  <div class="form-group"> 
				                                                      <label for="labelprice_orign" class="control-label">max</label> 
				                                                      <input class="form-control" id="labelprice_orign" value="0" type="text" placeholder="支持的最大版本号" name="max_version">
				                                                  </div> 
				                                              </div> 
				                                          </div>
				                                          <div class="row"> 
				                                              <div class="col-md-6"> 
				                                                  <div class="form-group"> 
				                                                      <label for="labelprice_final" class="control-label">大小</label> 	
				                                                  	  <input class="form-control" id="labelprice_final" value="1024" type="text" placeholder="包大小" name="zip_size">
				                                    	          </div> 
				                                              </div> 
				                                              <div class="col-md-6"> 
				                                                  <div class="form-group"> 
				                                                      <label for="labeldesc" class="control-label">链接</label> 
				                                                      <input class="form-control" id="labeldesc" type="text" placeholder="包地址" name="zip_url">
				                                                  </div> 
				                                              </div> 
				                                          </div>
				                                     
								  					</div>
											   <div class="modal-footer">
											   		<input  type="hidden"  name="ac" value="shopTest_class"/>
											   		<input  type="hidden"  name="op" value="addShopZip"/>
												    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
												    <button type="button" id="addsource" class="btn btn-primary">添加</button>
											   </div>
											   </form>
				                                       
				                        </div><!-- /.modal-content -->
				                         </div><!-- /.modal-dialog -->
				                     </div><!-- /.modal -->
   											
		                            </div>
                                	<div class="col-md-6 col-sm-6 col-xs-6">
	                                	<!-- Search -->
									    <form class="form-inline" role="form" action="admin.php" method="get" style="float:right;">
		                                    <div class="form-group">
		                                        <input type="text" class="form-control"  placeholder="pid" name="pid">
		                                    </div>
		                                     <div class="form-group">
		                                        <select class="form-control" name="platform">
					                                <option value="" >--平台--</option>
					                                <option value="pinkdiaryandroid" >安卓</option>
					                                <option value="pinkdiaryios" >ios</option>
					                                <option value="pinkdiaryproios" >ios专业</option>
					                            </select>
		                                    </div>
											<div class="form-group">
												<select class="form-control" name="n_type">
													<option value="" >--类型--</option>
													<option value="5" >皮肤包</option>
													<option value="16" >书桌包</option>
												</select>
											</div>
		                                     <input type='hidden' name="ac" value="shopTest_class"/>
		                                     <input type='hidden' name="op" value="getShopzipList"/>
		                                    <button type="submit" class="btn btn-success m-l-10">点击搜索</button>
		                                </form>
		                            </div>
                            </div>         
                            <div class="row">
                                <div class="col-md-12 col-sm-12 col-xs-12">
                                    <table id="datatable" class="table table-striped table-bordered">
                                        <thead>
                                            <tr>
												<th>ID</th>
                                            	<th>对应pid</th>
												<th>类型</th>
                                                <th>平台</th>
                                                <th>最低版本号</th>
                                                <th>最高版本号</th>
                                                <th>状态</th>                                         
                                                <th>编辑</th>                                                                                       
                                            </tr>
                                        </thead>
                                       <tbody>
                                         	<!--{loop $list $value}-->
										<tr>
											<th><!--{$value[id]}--></th>
											<th><!--{$value[pid]}--></th>
											<th>
												<!--{if $value[platform] == 'pinkdiaryios'}-->
													<span class="label label-info">IOS</span>
												<!--{elseif  $value[platform] == 'pinkdiaryproios'}-->
													<span class="label label-danger">IOS专业版</span>
												<!--{else}-->
													<span class="label label-success">安卓</span>
												<!--{/if}-->
											</th>
											<th>
												<!--{if $value[type]==5}-->
												<span class="label label-primary">皮肤</span>
												<!--{elseif $value[type]==16}-->
												<span class="label label-danger">书桌</span>
												<!--{/if}-->
											</th>
											<th>{$value[min_version]}</th>
											<th>{$value[max_version]}</th>
											<th>
												<!--{if $value[status] == 0}-->
													<i class="ion-checkmark-round"></i>
												<!--{else}-->
													<i class="ion-close-round"></i>
												<!--{/if}-->
											</th>
											<th data-id="{$value[id]}" data-op="getShopZipInfo" >
												<a href="#" class="on-default edit-row btn btn-default btn-sm getshopdetail" ><i class="fa fa-pencil"></i></a>
											</th>
										</tr>
										<!--{/loop}-->
					                     </tbody>
					              </table>
                                         <!--{if $pageUrl}-->
                                         <ul class="pager">
                                             <li>
                                                 <a href="{$pageUrl['prev']}">
                                                     <i class="fa fa-angle-double-left"></i> 上一页
                                                 </a>
                                             </li>
                                             <li>
                                                 <a href="{$pageUrl['first']}">
                                                     <i class="fa"></i> 第一页
                                                 </a>
                                             </li>
                                             <li>
                                                 <a href="{$pageUrl['next']}"> 下一页
                                                     <i class="fa fa-angle-double-right"></i>
                                                 </a>
                                             </li>
                                         </ul>
                                         <!--{/if}--> </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- Page Content Ends -->
                <!-- ================== -->
    
                <!-- /.modal -->

                <!-- Footer Start -->
                <!--{template admin_v2/footer}-->
                <!-- Footer Ends --> </section>
            <!-- Main Content Ends -->

            <!-- js placed at the end of the document so the pages load faster -->
            <script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>

            <script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/handlebars-v4.0.5.js');}-->"></script>
			<script src="<!--{eval echo register_static('layer/layer.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>

            <!-- Modal-Effect -->
            <script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>
			 <script  type="text/template" id="editsource">	
				{{#.}}	
				<div class="container">
              <form action="admin.php" method="get" id="editsourcedata">                                 
                   	<div class="row"> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labelid1" class="control-label">id号</label>
                               	  <input class="form-control" id="labelid1" type="text"  placeholder="id" name="id" value="{{detail.id}}">
                               </div> 
                           </div> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labelname" class="control-label">皮肤</label>                                                     
                                   <input class="form-control" id="labelname" type="text" placeholder="pid" name="pid" value="{{detail.pid}}">
                               </div> 
                           </div> 
                       </div>                                         
                        <div class="row"> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labelstatus1" class="control-label">分类</label>
                               	  <select name="status" class="form-control" id="labelstatus1">
                               	  		<option value="1"  {{detail.status_css.[1]}}>下架</option>
                               	   		<option value="0"  {{detail.status_css.[0]}}>上架</option>
 								 </select>
                 	          </div> 
                           </div> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labelplatform" class="control-label">平台</label>
                               	  <select  name="platform" class="form-control" id="labelplatform">
									<option value="pinkdiaryandroid" {{detail.platform_css.pinkdiaryandroid}}>安卓</option>
									<option value="pinkdiaryios" {{detail.platform_css.pinkdiaryios}}>IOS</option>
									<option value="pinkdiaryproios" {{detail.platform_css.pinkdiaryproios}}>IOS专业版</option>
									 </select>
                               </div> 
                           </div> 
                       </div> 
                     
                       <div class="row"> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labelmin" class="control-label">min</label>
                               	  <input class="form-control" id="labelmin" type="text"  placeholder="支持的最小版本号" name="min_version"  value="{{detail.min_version}}">
                 	          </div> 
                           </div> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labelmax" class="control-label">max</label>
                                   <input class="form-control" id="labelmax"  type="text" placeholder="支持的最大版本号" name="max_version" value="{{detail.max_version}}">
                               </div> 
                           </div> 
                       </div>
                       <div class="row"> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labelsize" class="control-label">大小</label>
                               	  <input class="form-control" id="labelsize"  type="text" placeholder="包大小" name="zip_size" value="{{detail.zip_size}}">
                 	          </div> 
                           </div> 
                           <div class="col-md-6"> 
                               <div class="form-group"> 
                                   <label for="labellink" class="control-label">链接</label>
                                   <input class="form-control" id="labellink" type="text" placeholder="包地址" name="zip_url" value="{{detail.zip_url}}">
                               </div> 
                           </div> 
                       </div>
   				<input  type="hidden"  name="ac" value="shopTest_class"/>
   				<input  type="hidden"  name="op" value="editShopZipInfo"/>
				<input  type="hidden"  name="type" value="{{detail.type}}"/>
	    		<button type="button" style="float:right"  id="editsource" class="btn btn-primary">修改</button>
  			 </form>
			</div>
			{{/.}}
			</script>
            <script type="text/javascript">
            
            $(document).ready(function() {
                // 设置table配置
                $('#datatable').dataTable({
                    "iDisplayLength": 50,
                    "aLengthMenu": [10, 20, 50, 100],
                    "searching": false,
                    "bLengthChange" : false,
                    "bSort" : false,
                    "bPaginate": false
                });            
            });
            
         	$(document).on('click','#editsource',function(){
          	   //编辑    
          	   		 var data=$("#editsourcedata").serialize()
          	   		 layer.closeAll()
                 	 swals(data);	                  
          	});
          	
          	$(document).on('click','#addsource',function(){
           	   //增加    
           	   		 layer.closeAll()
           	   	     swals($("#addsourcedata").serialize());	                
           	});
            var tp_editsource = Handlebars.compile($('#editsource').html());  
            $(".getshopdetail").click(function() {
	             	var shop = $(this).parent().data();
	            	var id   = shop.id;
	            	var op   = shop.op;
					var index = layer.load();
	        		$.ajax(
	    		            {
	    		                url     :   "admin.php",
	    		                type    :   "GET",
	    		                data    :   {'id' : id,'ac':'shopTest_class','op':op},
	    		                success :   function(data)
	    		                            {    		                				
	    		                				var html = tp_editsource(data)        		                				
	    		                				layer.close(index);
	    		                				layer.open({
	    		                					  type: 1,
	    		                					  title:'编辑皮肤包',
	    		                					  skin: 'layui-layer-demo', //样式类名
	    		                					  closeBtn: 1, //显示关闭按钮
	    		                					  shift: 2,
	    		                					  area:['65%',"40%"],
	    		                					  shadeClose: true, //开启遮罩关闭
	    		                					  content: html
	    		                				});    
	    		                            }
            		});       	
	    	});
			var swals = function (data, url, title, text){
				if (url === undefined) {
					url = "admin.php?ac=shopTest_class";
				}
				if (title === undefined) {
					title = "确认操作?";
				}
				if (text === undefined) {
					text  = "请慎重操作!";
				}
            	swal(
                		{   
	                		title: title,
	                		text: text,
	                		type: "warning",   
	                		showCancelButton: true,   
	                		confirmButtonColor: "#DD6B55",   
	                		confirmButtonText: "Sure!",   
	                		closeOnConfirm: false 
                		}, 
                		function(){
                			$.ajax(
                		            {
                		            	dataType:   "json",
                		                url     :   url,
                		                type    :   "GET",
                		                data    :   data,
                		                success :   function(data)
                		                            {
                		                				if(data==1){              		          
                		                					swal("操作完成!", "", "success");
                		                				}else{
                		                					swal("操作失败!", "", "error"); 
                		                				}
                		                				refresh();
                		                            }
                		            });
                		});        	
            }
            // 刷新当前页面
            var refresh=  function (){
                setInterval(window.location.reload(),5000);
            }
            
           
            
         	
        </script>
</body>
        </html>